/* const obj = {
  a: 1,
  b: 2,
  c: "abcd",
};

for (const key in obj) {
  console.log("key:", key);
  console.log("value:", obj[key]);
}

Object.entries(obj).forEach(([key, value]) => {
  console.log(`key=${key},value=${value}`);
}); */

/* const str = "adaerasdfagasdf";
function countCharacter(str) {
  const characterCount = {};
  for (const char of str) {
    if (characterCount[char]) {
      characterCount[char]++;
    } else {
      characterCount[char] = 1;
    }
  }

  return characterCount;
}

console.log(countCharacter(str));

const ret = Array.from(str).reduce((pre, cur) => {
  pre[cur] ? (pre[cur] = pre[cur] + 1) : (pre[cur] = 1);
  return pre;
}, {});
console.log(ret); */

const arr = [1, 2, 3];
console.log(arr.map((v) => ({ number: v, doubleNumber: v * 2 })));
